package test;

import java.util.StringTokenizer;

public class C4MessageProcessor {
	public static void main(String[] args) {
		String message = "";
		StringTokenizer tokenizer;
		
//		message += 	"<C4Message>\n\t<Update name=\"Install\" uid=\"112300\">\n\t\t" +
//					"<Param name=\"Status\" value=\"Success\"/>\n\t</Update>\n</C4Message>";
		message += "<C4Message>\n\t<TroubleTicketResponse uid=\"23333\"/>\n</C4Message>";
		
		
		System.out.println("Message created: \n" + message);
		
		tokenizer = new StringTokenizer(message,"\"");
		
		if (message.indexOf("<Update name=") > -1) {
			//UID will be the 4th token
			for(int j = 0; j <= 2; j++) 
				tokenizer.nextToken();
			System.out.println("Request Installation Update- UID: " + tokenizer.nextToken());
		}
		else {
			//UID will be the 2nd token
			tokenizer.nextToken();
			System.out.println("Trouble Ticket Update- UID: " + tokenizer.nextToken());
		}
	}
}
	